<?php
	require_once('auth.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2" />
<title>Member Index</title>
<link href="style/loginmodule2.css" rel="stylesheet" type="text/css" />
</head>
<body>
<center>
<div class="header">
<h1>Welcome <?php echo $_SESSION['SESS_USERNAME'];?></h1>
</div>
<div class="navbar">
<?php
if($_SESSION["SESS_MEMBER_ID"] != '1') {
echo "<a href='register-form.php'><button type='button'><img src='style/images/pickaxe.png'></img> Register</button></a>";
echo "<a href='login.php'><button type='button'><img src='style/images/gold_pick.png'></img> Login</button></a>";
}
?>
<a href="commands.php"><button type="button"><img src="style/images/commands.png"></img> Commands</button></a>
<?php
if($_SESSION["SESS_MEMBER_ID"] == '1') {
echo "<a href='vote.php'><button type='submit'><img src='style/images/vote.png'></img> Vote</center></button></a>";
}
?>
</div>
</center>
<div class="sidebar">
<iframe src="http://www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2Fpages%2FRevolution-MineCraft-Server%2F226060457443577&amp;width=225&amp;colorscheme=dark&amp;show_faces=false&amp;border_color&amp;stream=true&amp;header=true&amp;height=427" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:225px; height:427px;" allowTransparency="true"></iframe>
</div>
<div class="tartalom">
<?php

// load the configuration file.

include("config.php");
//load all news from the database and then OREDER them by newsid
//you will notice that newlly added news will appeare first.
//also you can OREDER by (dtime) instaed of (news id)
$connect = mysql_connect($dbhost, $dbusername, $dbpassword);
mysql_select_db($dbname,$connect) or die ("Could not select database");
$result = mysql_query("SELECT * FROM news ORDER BY newsid DESC",$connect);

//lets make a loop and get all news from the database
while($myrow = mysql_fetch_assoc($result))
{//begin of loop

//now print the results:
echo "<b>Title: ";
echo $myrow['title'];
echo "</b><br>On: <i>";
echo $myrow['dtime'];
echo "</i><hr align=left width=160>";
echo $myrow['text'];

// Now print the options to (Read,Edit & Delete the news)
echo "<br><a href=\"read_more.php?newsid=$myrow[newsid]\">Read More...</a>
|| <a href=\"edit_news.php?newsid=$myrow[newsid]\">Edit</a>
|| <a href=\"delete_news.php?newsid=$myrow[newsid]\">Delete</a><br><hr>";

}//end of loop

?>
</div>
</body>
</html>
